import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { HomeComponent } from '../components/home/home';
import { AssetlistComponent } from '../components/assetlist/assetlist';
import { AssetoutComponent } from '../components/assetout/assetout';
import { AssetdeliverComponent} from '../components/assetdeliver/assetdeliver';
import { AssetbackComponent} from '../components/assetback/assetback';
import {Loginauth} from '../service/loginauth';
import { AssetTypeService } from '../service/assetTypeService';
import { AssetrepairComponent } from '../components/assetrepair/assetrepair';
import { AssetclearComponent } from '../components/assetclear/assetclear';
import { DepartmentlistComponent } from '../components/departmentlist/departmentlist';
import { UserListComponent } from '../components/userList/userList';
import { AssetenterInfoComponent } from '../components/assetenterInfo/assetenterInfo';
import { MessageinfoComponent } from '../components/messageinfo/messageinfo';
import { InsertmsgComponent } from '../components/insertmsg/insertmsg';
import { IndexpageComponent } from '../components/indexpage/indexpage';

const routes: Routes = [
  {
    path: '',
    component: HomeComponent,
    children: [
      {
        path: 'index',
        component: IndexpageComponent,
        canActivate: [Loginauth]
      },
      {
        path: 'assetManage',
        canActivate: [Loginauth],
        children: [
          {
            path: '',
            component: AssetlistComponent,
            canActivate: [Loginauth],
            resolve: {
              assetType: AssetTypeService
            },
          },
          {
            path: 'assetenterinfo',
            component: AssetenterInfoComponent
          },
          {
            path: 'assetout',
            component: AssetoutComponent
          },
          {
            path: 'assetdeliver',
            component: AssetdeliverComponent
          },
          {
            path: 'assetback',
            component: AssetbackComponent
          },
          {
            path: 'assetrepair',
            component: AssetrepairComponent
          },
          {
            path: 'assetclear',
            component: AssetclearComponent
          }
        ]
      },
      {
        path: 'systemManage',
        canActivate: [Loginauth],
        children: [
          {
            path: '',
            component: DepartmentlistComponent,
            canActivate: [Loginauth]
          },
          {
            path: 'userlist',
            component: UserListComponent
          }]
      },
      {
        path: 'messageinfo',
        canActivate: [Loginauth],
        children: [
          {
            path: '',
            component: MessageinfoComponent,
            canActivate: [Loginauth]
          },
          {
            path: 'insertmsg',
            component: InsertmsgComponent
          }]
      }
    ]
  }
];

@NgModule({
  imports: [ RouterModule.forChild(routes) ],
  exports: [ RouterModule ],
  providers: [
  ]

})
export class HomeRoutingModule {}
